/*
Building a Clean and Loyal State: The Strategic Dilemma of an Anti-corruption Campaign Under One-Party Rule
Authors: Tianyang Xi, Yang Yao and Qian Zhang
Date: Oct, 30, 2023
Stata Version 14.0
Operating System: Micrsoft Windows 10
*/

clear
set more off
capture log close

*-------------------------------Table A2------------------------------------*
use "promotion.dta", clear

*define first terms and secend terms
gen first_term=1 if (year>=1994 & year<=1997) | (year>=2003 & year<=2007) |(year>=2013 & year<=2017) 
replace first_term=0 if first_term==.
gen second_term=1 if (year>=1998 & year<=2002) | (year>=2008 & year<=2012) |(year>=2018 & year<=2021) 
replace second_term=0 if second_term==.

*column (1)
probit promotion ability connectionc_yes i.location i.year if first_term==1, r
margins, dydx(connectionc_yes ability) //calculate marginal effects of connection and capability

*column (2)
probit promotion ability connectionc_yes college_onjob_yes mini_nat gender age age2 i.location i.year if first_term==1, r
margins, dydx(connectionc_yes ability) //calculate marginal effects of connection and capability

*column (3)
probit promotion ability connectionc_yes i.location i.year if second_term==1, r
margins, dydx(connectionc_yes ability) //calculate marginal effects of connection and capability

*column (4)
probit promotion ability connectionc_yes college_onjob_yes mini_nat gender age age2 i.location i.year if second_term==1, r
margins, dydx(connectionc_yes ability) //calculate marginal effects of connection and capability

